//simple.cpp

#include "simple.h"
#include <wx/colour.h>
#include <wx/aboutdlg.h>


//This is the object's constructor, which initializes a board object.
Simple::Simple(const wxString& title)
  : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(800, 800))
{
  wxStatusBar* sb = CreateStatusBar();

  b = new board(this);
  b->SetFocus();
  
  //These are the wxButtons that control Starting, Pausing, Info screens,
  //and quitting the application  
  wxButton *start = new wxButton(b, wxID_OK, wxT("Start"),wxPoint(20, 20));
  wxButton *info = new wxButton(b,wxID_ABOUT, wxT("Info"),wxPoint(20, 60));
  wxButton *pause = new wxButton(b,wxID_HELP, wxT("Pause"),wxPoint(20, 100));
  wxButton *quit = new wxButton(b,wxID_EXIT, wxT("Quit"),wxPoint(20, 140));

  start->Show(true); 
  info->Show(true);
  pause->Show(true);
  quit->Show(true);


  //These connect the buttons to the event handlers for them
  Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Simple::Start));
  Connect(wxID_ABOUT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Simple::Info));
  Connect(wxID_HELP, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Simple::Pause));
  Connect(wxID_EXIT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Simple::Quit));
  

  start->SetFocus();
  info->SetFocus();
  pause->SetFocus();
  quit->SetFocus();

  Centre();
}

//This controls the function of the start button
void Simple::Start(wxCommandEvent & WXUNUSED(event))
{
 
  b->setTurnongaucho(true);
  b->Start();  
  
}

//This controls the function of the Info button
void Simple::Info(wxCommandEvent & WXUNUSED(event))
{ 
  wxAboutDialogInfo aboutInfo;
  aboutInfo.SetName(_("Storke Tower Defense"));
  aboutInfo.SetDescription(_("The enemies will snake from top left corner in vertical lines all the way to the right, skipping rows. To place Gauchos, make sure you have enough resources and left click at locations on the grid. The Gauchos will shoot at the enemies. Your goal is to keep the enemies from getting to Storke Tower. Each enemy will take one life from Storke Tower, so if five enemies make it there, you lose the game. Good luck!"));
  aboutInfo.SetCopyright(_("(C) Fall 2011"));
  aboutInfo.AddDeveloper(_("Greg Dreschler"));
  aboutInfo.AddDeveloper(_("Brynn Kiefer"));
  aboutInfo.AddDeveloper(_("Joey Phommasone"));
  aboutInfo.AddDeveloper(_("Carina Rammelkamp"));

  wxAboutBox(aboutInfo);
  
}

//This controls the function of the pause button
void Simple::Pause(wxCommandEvent & WXUNUSED(event))
{
  b->Pause();
}

//This controls the function of the quit button
void Simple::Quit(wxCommandEvent & WXUNUSED(event))
{
  Close(true);
}
